package com.example.day0818_sever;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.window.dialog.ToastDialog;
import ohos.rpc.IRemoteObject;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
import ohos.rpc.RemoteObject;

public class ServiceAbility_one extends Ability {
    private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "Demo");

    @Override
    public void onStart(Intent intent) {
        HiLog.error(LABEL_LOG, "ServiceAbility_one::onStart");
        super.onStart(intent);
        new ToastDialog(this).setText("onStart").show();

    }

    @Override
    public void onBackground() {
        super.onBackground();
        HiLog.info(LABEL_LOG, "ServiceAbility_one::onBackground");
        new ToastDialog(this).setText("onBackground").show();
    }

    @Override
    public void onStop() {
        super.onStop();
        HiLog.info(LABEL_LOG, "ServiceAbility_one::onStop");
        new ToastDialog(this).setText("onStop").show();

    }

    @Override
    public void onCommand(Intent intent, boolean restart, int startId) {
        HiLog.info(LABEL_LOG, "ServiceAbility_one::onCommand");
        new ToastDialog(this).setText("onCommand").show();

    }

    @Override
    public IRemoteObject onConnect(Intent intent) {
        HiLog.info(LABEL_LOG, "ServiceAbility_one::onConnect");
        new ToastDialog(this).setText("onConnect").show();
        return new CurrentRometeObject();
    }

    @Override
    public void onDisconnect(Intent intent) {
        HiLog.info(LABEL_LOG, "ServiceAbility_one::onDisconnect");
        new ToastDialog(this).setText("onDisconnect").show();
    }
    private class CurrentRometeObject extends RemoteObject {
        public CurrentRometeObject() {
            super("descriptor");
        }
    }
}